Release 10.1A: OpenEdge Data Management:
SQL Reference
CAST
Converts an expression to another data type. The first argument is the expression to be converted. The second argument is the target data type.
The length option for the
data_typeargument specifies the length for conversions toCHARandVARCHARdata types. If omitted, the default is 1 byte.If the expression evaluates to
NULL, the result of the function is null. SpecifyingNULLwith theCASTfunction is useful for set operations, such asUNION, that require two tables to have the same structure.CAST NULLallows you to specify a column of the correct data type, so a table with a similar structure to another, but with fewer columns, can be in a union operation with the other table.The
CASTfunction provides a data-type-conversion mechanism compatible with the SQL standard.Use the
CONVERTfunction, enclosed in theODBCescape clause { fn }, to specify ODBC-compliant syntax for data type conversion. See the ODBC compatibleCONVERTfunction for more information.Syntax
Example
The following SQL example uses
CASTto convert an integer field from a catalog table to aCHARACTERdata type:
Compatibility
SQL compatible
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |